home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 February / Software of the Month Club 1996 February.iso / pc / os2 / prcr / crprog.cmd next >
Encoding:
Text File  |  1996-01-08  |  1.7 KB  |  56 lines

  1. /* Program Creator v1.1 */
  2. /* Copyright (c) 1995 Anssi Blomqvist */
  3.  
  4. Call rxfuncadd 'SysCreateObject', 'RexxUtil', 'SysCreateObject'
  5. Say
  6. Say '                   Program Creator version 1.1'
  7. Say '                   ---------------------------'
  8. Say
  9. Say '(c) 1995 Anssi Blomqvist, abblomqv@rock.helsinki.fi'
  10. Say
  11.  
  12. If Arg(1) = '' Then signal Usage
  13. Ar = Arg(1)
  14. Prog = Translate(Ar, ' ', '\')
  15. Prog = Translate(Prog, ' ', '.')
  16. Wcount = Words(Prog)
  17. Ext = Translate(Word(Prog, Wcount))
  18. If (Ext <> 'EXE') & (Ext <> 'CMD') & (Ext <> 'COM') & (Ext <> 'BAT') Then signal Usage
  19. Pname = Word(Prog, Wcount-1)
  20. Caps = (verify(Pname,Xrange('A','Z'))=0)
  21. Small = (verify(Pname,Xrange('a','z'))=0)
  22. If Caps | Small then Progname = Insert(Translate(Substr(Pname,1,1)),Translate(Substr(Pname,2),Xrange('a','z'),Xrange('A','Z')))
  23. Else Progname = Pname
  24. drive = filespec('d',Ar)
  25. path = filespec('p',Ar)
  26. If path<>'' Then path = Substr(path,1,length(path)-1)
  27. cdir = Directory(Insert(drive,path))
  28. If cdir ='' then signal error
  29. If Substr(cdir,length(cdir)) <> '\' then cdir=Insert(cdir,'\')
  30. Prog = Insert(cdir,filespec('n',Ar))
  31. Program = Insert('EXENAME=', Prog)
  32. Say 'Creating program object...'
  33. Say
  34.  
  35. result=SysCreateObject("WPProgram", Progname, "<WP_DESKTOP>", Program, "f")
  36. If result = 1 Then Say 'Object was successfully created.'
  37.     Else Do
  38.     Beep(440,400)
  39.     Say 'Error creating program object!'
  40.     Say "Check that there aren't already an object with the same name on the desktop."
  41.     '@Pause'
  42.     End
  43. Exit
  44.  
  45. Usage:    Say 'Usage:'
  46.     Say
  47.     Say 'CrProg Filename (with an .EXE .CMD .COM or .BAT -extension)'
  48.     Say 'You can also drag and drop the file on the Program Creator -icon.'
  49.     Say
  50.     '@Pause'
  51. Exit
  52.  
  53. Error:  Beep(440,400)
  54.         Say 'Invalid path!'
  55. Exit
  56.